<%@ page contentType="text/html; charset=iso-8859-1" language='java' errorPage='erro.jsp' %>
<%@ page pageEncoding="UTF-8"%>
<%@ include file="../WEB-INF/jspf/cabecalho.jspf" %>
<%@ include file="../WEB-INF/jspf/acesso.jspf" %>
<%@ include file="../WEB-INF/jspf/setMeta.jspf" %>

<sql:query var='rsetCliente' dataSource='${con}'>    
    SELECT * FROM Cliente     
    WHERE idCliente = '<c:out value="${param.chv1}"/>'
</sql:query>

<form name="form1" method="post" action="../controller/editarCliente.jsp">
  <fieldset>
  <legend><font color="#0000FF"><strong>Editar Dados do Cliente</strong></font></legend>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <div align="center"> 
    <table width="32%" >
      <tr> 
        <td><strong>C&oacute;digo:</strong></td>
        <td colspan="3"><input name="idCliente" type="text" id="idCliente" value="${param.chv1}" size="10" readonly="" /></td>
      </tr>
      <tr> 
        <td><strong>&Oacute;rg&atilde;o:<font color="#FF0000">*</font></strong></td>
        <td colspan="3"><input name="orgao" type="text" id="orgao" value="<c:out value="${rsetCliente.rowsByIndex[0][1]}"/>" size="50" /></td>
      </tr>
      <tr> 
        <td><strong>Sigla:<font color="#FF0000">*</font></strong></td>
        <td colspan="3"><input name="sigla" type="text" id="siglaCliente" value="<c:out value="${rsetCliente.rowsByIndex[0][2]}"/>" /></td>
      </tr>
      <tr> 
        <td><strong>Telefone:</strong></td>
        <td colspan="3"><input name="telefone" type="text" id="telefoneCliente" value="<c:out value="${rsetCliente.rowsByIndex[0][3]}"/>" /></td>
      </tr>
      <tr> 
        <td><strong>Contato:</strong></td>
        <td colspan="3"><input name="contato" type="text" id="contatoCliente" value="<c:out value="${rsetCliente.rowsByIndex[0][4]}"/>" /></td>
      </tr>
      <tr> 
        <td><strong>Status:<font color="#FF0000">*</font></strong></td>
        <td colspan="3"><select name="statusCliente">
            <option >Ativo</option>
            <option >Inativo</option>
            <option selected="selected"><c:out value="${rsetCliente.rowsByIndex[0][5]}"/></option>
          </select></td>
      </tr>
      <tr> 
        <td height="21">&nbsp;</td>
        <td>&nbsp;</td>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr> 
        <td height="25"> <div align="right"> </div></td>
        <td><div align="center"> 
            <input type="button" name="cancelar" value="Cancelar" onclick="javascript:history.go(-1);"  />
          </div></td>
        <td> <div align="center"> 
            <input type="reset" name="limpar" value="Limpar" onclick=""/>
          </div></td>
        <td> <div align="center"> 
            <input type="submit" name="enviar" value="Enviar" onclick="javascript:verifica();"/>
          </div></td>
      </tr>
    </table>
  </div>
  
  <script language="javascript">
  function verifica(){
  
  // Atenção(Por wldutra): implementar aqui a verificação dos campos para validar
  
  document.form1.submit();
  
  }
  </script>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp; </p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  </fieldset>
</form>

</body>
</html>
